<header id="topbar">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a href="#op/game_order/">电玩城订单列表</a>
            </li>
        </ol>
    </div>
    <div class="topbar-right">
        <div class="ml15 ib va-m" id="toggle_sidemenu_r">
            <a href="#" class="pl5"> <i class="fa fa-sign-in fs22 text-primary"></i>
            </a>
        </div>
    </div>
</header>

<section id="content" class="animated fadeIn">
    <% if(items.length > 0){ %>
    <div class="panel overflow" >
        <table class="table table-striped fs13" id="main-list">
            <thead>
                <tr class="bg-light">
                    <th>订单id</th>
                    <th>用户id</th>
                    <th>游戏类型</th>
                    <% if(items[0].hasOwnProperty("bet_index")){ %>
                    <th>购买详情</th>
                    <th>期号</th>
                    <% }%>
                    <th>购买金额</th>
                    <th>中奖金额</th>
                    <th class="sortable" data-field="created_at">购买时间</th>
                    <th class="sortable" data-field="updated_at">最后更新时间</th>
                </tr>
            </thead>
            <tbody class="admin-form">

                <% var moment = require('moment');
                   var buyAmount = 0;
                   var winAmount = 0;
                %>
                <%if(items.length > 0){
                    _.each(items, function(item){
                    buyAmount += parseFloat(item.bet_amount);
                    winAmount += parseFloat(item.award_amount);
                %>
                    <tr data-id="<%= item.id %>" >
                        <td><a class="modify-item"><%= item.id %></a></td>
                        <td><a href="/#stats/account/?id=<%= item.user_id %>"><%= item.user_id %></a></td>
                        <td><%= GAME_TYPE[item.type]%></td>
                        <% if(item.type == 104){ %>
                        <td><%= LOTTERY_INDEX[item.bet_index]%></td>
                        <td><a href="/#op/lottery_part/?term_number=<%= item.term_number %>"><%= item.term_number %></td>
                        <% } %>
                        <% if(item.type == 101){ %>
                        <td><%= BULL_INDEX[item.bet_index]%></td>
                        <td><a href="/#op/bull_part/?term_number=<%= item.term_number %>"><%= item.term_number %></td>
                        <% } %>
                        <% if(item.type == 103){ %>
                        <td><%= FRUIT_INDEX[item.bet_index]%></td>
                        <td><a href="/#op/fruit_part/?term_number=<%= item.term_number %>"><%= item.term_number %></td>
                        <% } %>
                        <td><%= item.bet_amount %></td>
                        <td><%= item.award_amount %></td>
                        <td><%= item.created_at %></td>
                        <td><%= item.updated_at %></td>
                    </tr>
                <% }) %>
            <%}%>
            </tbody>
        </table>
    </div>
    <div><div class="pull-left" id="page-tips"></div>
        <span style="margin-left:20px;">本页累计投注金额：</span><span style="color:#F00"><%= (buyAmount).toFixed(3) %></span>
        <span style="margin-left:20px;">本页累计中奖金额：</span><span style="color:#F00"><%= (winAmount).toFixed(3) %></span>
        <span style="margin-left:20px;">本页累计盈亏金额：</span><span style="color:#F00"><%= (winAmount - buyAmount).toFixed(3) %></span>
        <span style="margin-left:20px;">总共累计投注金额：</span><span style="color:#F00"><%= parseFloat(bet_total).toFixed(3) %></span>
        <span style="margin-left:20px;">总共累计中奖金额：</span><span style="color:#F00"><%= parseFloat(award_total).toFixed(3) %></span>
        <span style="margin-left:20px;">总共累计盈亏金额：</span><span style="color:#F00"><%= (parseFloat(award_total) - parseFloat(bet_total)).toFixed(3) %></span>
        <div id="paginator"></div>
    </div>
    <% }else{ %>
    <h4 class="text-muted">无数据</h4>
    <% } %>
</section>


<!-- Panel popup -->
<div id="editWithdrawPanel" class="popup-basic popup-lg bg-none mfp-with-anim mfp-hide">
    <div class="panel">
        <div class="panel-heading">
            <span class="panel-icon"><i class="fa fa-pencil"></i></span>
            <span class="panel-title">订单详情</span>
        </div>
        <div class="panel-body">
            <form id="behavior-form" class="form-horizontal" role="form">
            <div class="form-group">
                <label for="order_id" class="col-md-3 control-label">订单id：</label>
                <div class="col-md-9">
                    <p class="form-control-static text-muted" id="order_id">
                    </p>
                </div>
            </div>
            <div class="form-group">
                <label for="user_id" class="col-md-3 control-label">用户编号：</label>
                <div class="col-md-9">
                    <p class="form-control-static text-muted" id="user_id">
                    </p>
                </div>
            </div>
            <div class="form-group">
                <label for="activity_type" class="col-md-3 control-label">游戏类型：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="activity_type">
                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="bet_name" class="col-md-3 control-label">购买详情：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="bet_name">
                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="term" class="col-md-3 control-label">期号：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="term">
                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="price" class="col-md-3 control-label">购买金额：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="price">

                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="win_price" class="col-md-3 control-label">中奖金额：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-danger" id="win_price">

                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="created_at" class="col-md-3 control-label">购买时间：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="created_at">
                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="updated_at" class="col-md-3 control-label">最后更新时间：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="updated_at">
                  </p>
                </div>
            </div>
            </form>
        </div>
        <div class="panel-footer text-right">
            <button class="btn btn-primary" type="button" id="submitClose">关闭</button>
        </div>
    </div>
</div>


<!-- Start: Right Sidebar -->
<aside id="sidebar_right" class="nano">
    <div class="p20 admin-form">

        <h4 class="mt5 text-muted fw500">过滤条件：</h4>
        <hr class="short">


        <h6 class="fw400">用户ID</h6>
        <div class="section mb15">
            <label for="searchUserID" class="field prepend-icon">
                <input type="text" title="用户ID" data-field="user_id" id="searchUserID" class="gui-input" placeholder="用户ID" value="<%= searched.user_id %>">
                <label for="searchUserID" class="field-icon"><i class="fa fa-tag"></i>
            </label>
            <i class="arrow doube"></i>
        </div>

        <h6 class="fw400">游戏种类</h6>
        <div class="section mb15">
            <label for="searchActivityType" class="field select">
                <select id="searchActivityType" name="searchActivityType" data-field="game">
                    <option value="lottery">大转盘</option>
                    <option value="bull" <%= searched.game == "bull" ? 'selected' : '' %>>百人牛牛</option>
                    <option value="kfc" <%= searched.game == "kfc" ? 'selected' : '' %>>老虎机</option>
                    <option value="fruit" <%= searched.game == "fruit" ? 'selected' : '' %>>水果机</option>
                </select>
                <i class="arrow double"></i>
            </label>
            <i class="arrow doube"></i>
        </div>
        <h6 class="fw400">下单时间</h6>
        <div class="section row">
            <div class="col-md-6">
                    <input type="text" title="下限，包含当天" name="searchCreatedAtLower" id="searchCreatedAtLower" class="gui-input" data-type="date" value="<%= searched.created_at_lower %>" placeholder=">=">
                    </label>
                </label>
            </div>
            <div class="col-md-6">
                    <input type="text" title="上限，不包括当天" name="searchCreatedAtUpper" id="searchCreatedAtUpper" class="gui-input" data-type="date" value="<%= searched.created_at_upper %>" placeholder="<">
                    </label>
                </label>
            </div>
        </div>
        <hr class="short">

        <button class="btn btn-default btn-block" type="button" id="search">搜索</button>
    </div>
</aside>
<!-- End: Right Sidebar -->


